<?php

/**
 * Login form
 *
 * @author    Mon Zafra <monzee at gmail>
 * @copyright (c)2009 Mon Zafra
 * @license   http://monzee.wordpress.com/license New BSD
 * @version   $Id: Login.php 38 2009-02-18 17:12:39Z monzee $
 */
class Admin_Form_Login extends Zend_Form
{
    public function init()
    {
        $builder = Zend_Controller_Action_HelperBroker::getStaticHelper('FormBuilder');
        $url = Zend_Controller_Action_HelperBroker::getStaticHelper('Url');
        $module = Zend_Controller_Action_HelperBroker::getStaticHelper('Module');

        $loginPage = $module->direct('admin')->getAccessManager()->getOption('loginPage');

        $builder->setForm($this)
            ->setMethod('post')
            ->setAction($url->url($loginPage))
            ->options(array('required' => true))
                ->addText('username', array('label' => 'Username'))
                ->addPassword('password', array('label' => 'Password'))
                ->addSubmit('submit', array('label' => 'Login'))
        ;
    }

}
